package command;

import javax.servlet.http.*;

/**
 * @author Antonin Mozzati
 * @author Yannick Schürter
 */
public class DeconnectCommand implements Command {

    @Override
    public String getCommandName() {
        return "deconnectCommand";
    }

    @Override
    public ActionFlow actionPerform(HttpServletRequest request) {
        String vue = "index";

	System.out.println(this.getCommandName());
	
        HttpSession session = request.getSession(false);

	//si l'utilisateur est connecté, on supprime la session
        if(session.getAttribute("sessionID")!=null) {
	    session.invalidate();
        } 
        
        return new ActionFlow(vue, vue + ".jsp", false);
    }

}
